(in-package :exp)

(defclass sound (state)
  ((sound :initarg :sound :accessor sound)
   (sample :accessor sample)))

(defmethod shared-initialize :after ((state sound) slots &key)
  (setf (sample state) (sdl-mixer:load-sample (gwee:resource (sound state)))))

(defmethod state-init (exp (state sound))
  (log exp 'start)
  (sdl-mixer:play-sample (sample state))
  (state-onward exp state))

(defmethod state-dump append (exp (state sound))
  `(:sound ,(sound state)))
